﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 实时曲线.UControls
{
    public partial class ParaTextBox : UserControl
    {
        public ParaTextBox()
        {
            InitializeComponent();
        }
        private string dataVal;
        /// <summary>
        /// 参数值
        /// </summary>
        public string DataVal
        {
            get { return dataVal; }
            set
            {
                dataVal = value;
                lblText.Text = dataVal+" "+unit;
            }
        }

        private string unit;
        /// <summary>
        /// 单位
        /// </summary>
        public string Unit
        {
            get { return unit; }
            set
            {
                unit = value;
                lblText.Text = dataVal + " " + unit; 
            }
        }

        private string varName;
        /// <summary>
        /// 参数变量名
        /// </summary>
        public string VarName
        {
            get { return varName; }
            set
            {
                varName = value;
            }
        }

        /// <summary>
        /// 参数编辑控件单击事件
        /// </summary>
        public event Action<object, EventArgs> ParaTextBoxClick;

        /// <summary>
        /// 数值文本点击事件

        private void lblText_Click(object sender, EventArgs e)
        {
            ParaTextBoxClick?.Invoke(this, new EventArgs());
        }
    }
}
